# NFC Demo Application Description

This is an NFC card reader demo application. It demonstrates how to perform hardware interaction, UI management, and data processing in a multi-threaded environment.

## Main functions

- **Real-time sensing**：Automatically detects the approach and departure of NFC cards.
- **Information Extraction**：Display the card's UID, type (e.g., Mifare One), SAK value, and ID length.
- **Buzzer feedback**：When the card is successfully detected, the hardware buzzer will emit a short beep.
- **Sector Read**：The data block content of the M1 card is read and formatted for display via RPC calls.

## Project Structure

The application employs a multi-threaded (Worker) architecture, ensuring both UI smoothness and hardware operation independence.

- `src/main.js`: **Main thread entry point**: It is responsible for launching the UI and NFC sub-threads.
- `src/uiWorker.js`: **UI thread**: Responsible for UI rendering, page switching logic, and event loop.
- `src/nfcWorker.js`: **Hardware thread**: It directly drives the NFC chip, handles card polling, and communicates with the UI thread via EventBus or RPC.
- `src/pages/`:
  - `HomePage.js`: The main control panel displays the real-time status.
  - `BlockDataPage.js`: The details page handles RPC requests for and displays block data.
- `src/UIManager.js`: A custom UI management framework that supports page registration, lifecycle callbacks, and route navigation.
- `dxmodules/`: A custom UI management framework that supports page registration, lifecycle callbacks, and route navigation.

## Core technologies

- **DejaOS UI system**: Use the `dxUi` series of components to build a native, smooth interface.
- **EventBus & RPC**: An efficient cross-thread communication mechanism.
- **PWM drive**: Control the hardware buzzer to achieve interactive feedback.
- **dxNfcCard**：It encapsulates the underlying NFC/M1 card operation protocol.

## Instructions for use

1. After launching the application, the main interface displays a red "No Card" status.
2. Bring a compatible NFC card (such as an M1 card) close to the device's sensing area.
3. After hearing the "beep" sound, the interface will turn green and display the card information.
4. Click the "Read Blocks" button to go to the details page and view the data.

---

> **hint**This example is for **ID Info 4000** The device is designed with a screen resolution of **480x320**Most of the interface layout and image resources are optimized for this resolution. Although the core business logic is universal across devices, UI adaptation is required if it needs to run on devices with different resolutions.
>
> Due to screen size limitations, this application currently only displays the contents of the first 6 data blocks of the card and does not include card writing functions such as modifying block data.
